all:SuggestionSlice sgserver

TOPDIR=..
EXE=sgserver
OBJ=sg_ice.o dict.o indexer.o sg_interface.o main.o service.o lru_cache.o
CXXFLAGS=-ggdb -O2 -Wall -std=c++0x -Wno-deprecated -pg 	# -DDEBUG
CXX=g++

## ICE CONF
ICE_HOME=/opt/Ice-3.4.2
SLICE2CPP=$(ICE_HOME)/bin/slice2cpp
## ICE CONF

LIBS=-L$(ICE_HOME)/lib -lIce -L/usr/lib -lgflags -lglog
INCLUDES=-I. -I$(ICE_HOME)/include
RM=rm
CP=cp

%.o:%.cpp
	$(CXX) $(CXXFLAGS) -c $(INCLUDES) $<

SuggestionSlice:slice/sg_ice.ice
	$(SLICE2CPP) $<
	$(CXX) $(CXXFLAGS) -c $(INCLUDES) sg_ice.cpp

$(EXE):$(OBJ)
	$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
	$(CP) -rf $@ $(TOPDIR)/bin
	$(CP) -rf start.sh $(TOPDIR)/bin

clean:
	$(RM) -rf $(OBJ) $(EXE) $(TOPDIR)/bin/$(EXE) $(TOPDIR)/bin/start.sh sg_ice.*
